package xs.szw.common.result;

import lombok.Getter;

/**
 * @program: My_SpringSecurity
 * @description:
 * @author: Songzw
 * @create: 2025-02-06 14:35
 **/
@Getter
public enum ResultCode
{

    /**操作失败**/
    RC999("999","资源不存在"),
    RC900("900","基础错误"),
    /**操作成功**/
    RC200("200","success"),
    /**服务降级**/
    RC201("201","服务开启降级保护,请稍后再试!"),
    /**热点参数限流**/
    RC202("202","热点参数限流,请稍后再试!"),
    /**系统规则不满足**/
    RC203("203","系统规则不满足要求,请稍后再试!"),
    /**授权规则不通过**/
    RC204("204","授权规则不通过,请稍后再试!"),
    /**无权限**/
    RC403("403","无访问权限,请联系管理员授予权限"),
    /**access_denied**/
    RC401("401","匿名用户访问无权限资源时的异常"),
    RC404("404","404页面找不到的异常"),
    /**服务异常**/
    RC500("500","系统异常，请稍后重试"),
    RC375("375","数学运算异常，请稍后重试"),
    //登录、退出
    LOGIN_SUCCESS("2000","登录系统成功！"),
    LOGIN_FAIL("2002","退出系统成功！"),

    INVALID_TOKEN("2001","访问令牌不合法"),

    CLIENT_AUTHENTICATION_FAILED("1001","客户端认证失败"),
    USERNAME_OR_PASSWORD_ERROR("1002","用户名或密码错误"),
    BUSINESS_ERROR("1004","业务逻辑异常"),
    UNSUPPORTED_GRANT_TYPE("1003", "不支持的认证模式"),

    //令牌
    ACCESS_DENIED("A0301","没有权限访问该资源"),
    ACCESS_TOKEN_INVALID("A0230", "访问令牌无效或已过期"),
    REFRESH_TOKEN_INVALID("A0231", "刷新令牌无效或已过期"),
    // 验证码错误
    USER_VERIFICATION_CODE_ERROR("A0240", "用户验证码错误"),
    USER_VERIFICATION_CODE_ATTEMPT_LIMIT_EXCEEDED("A0241", "用户验证码尝试次数超限"),
    USER_VERIFICATION_CODE_EXPIRED("A0242", "用户验证码过期"),

    FILED_VALIDATION_CODE_ERROR("B0254", "请求参数校验错误"),
    USER_DUPLICATE_REQUEST("A0506", "请求过于频繁，请稍后再试。");


    /**自定义状态码**/
    private final String code;

    /**自定义描述**/
    private final String message;

    ResultCode(String code, String message){
        this.code = code;
        this.message = message;
    }

}
